

<%@ page import="bookstore.base.Editora" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'editora.label', default: 'Editora')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
        <br/><br/>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1><br/>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${editoraInstance}">
            <div class="errors">
                <g:renderErrors bean="${editoraInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${editoraInstance?.id}" />
                <g:hiddenField name="version" value="${editoraInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="nome"><g:message code="editora.nome.label" default="Nome" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: editoraInstance, field: 'nome', 'errors')}">
                                    <g:textField name="nome" value="${editoraInstance?.nome}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="endereco"><g:message code="editora.endereco.label" default="Endereco" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: editoraInstance, field: 'endereco', 'errors')}">
                                    <g:textField name="endereco" value="${editoraInstance?.endereco}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="telefone"><g:message code="editora.telefone.label" default="Telefone" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: editoraInstance, field: 'telefone', 'errors')}">
                                    <g:textField name="telefone" value="${editoraInstance?.telefone}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="livros"><g:message code="editora.livros.label" default="Livros" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: editoraInstance, field: 'livros', 'errors')}">
                                    
<ul>
<g:each in="${editoraInstance?.livros?}" var="l">
    <li><g:link controller="livro" action="show" id="${l.id}">${l?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="livro" action="create" params="['editora.id': editoraInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'livro.label', default: 'Livro')])}</g:link>

                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
